<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags"%>

<!DOCTYPE html>
<html>
<s:include value="/WEB-INF/content/common/header.jsp"></s:include>
</head>
<body class="bg">
	<div class="container">
		<s:include value="/WEB-INF/content/common/title-head.jsp"></s:include>

		<div class="content">

			<s:include value="/WEB-INF/content/common/tab.jsp"></s:include>

			<script>
				$("#userTab").addClass("active");
			</script>

			<div id="body">
				<div class="row">
					<div class="col-lg-10 col-lg-offset-1">
						<div class="span10 title">
							<h2>
								<s:text name="page.heading.list" />
							</h2>
						</div>
						<div class="create-area right">
							<table class="pull-right" width="400px">
								<tr>
									<td><s:form class="form-inline" action="search"
											namespace="/irisUser" theme="simple">
											<table>
												<tr>
													<%-- <td><s:url action="search" namespace="/irisUser"
															var="irisUserSearchUrl" /> <input type="text"
														class="form-control" name="searchTerm"
														placeholder="Enter search terms"></td>
													<td><s:a href="%{#irisUserSearchUrl}"
															cssClass="btn btn-primary">Search</s:a></td> --%>
													<td><input type="text" class="form-control"
														name="searchTerm" placeholder="Enter search terms"></td>
													<td><s:submit cssClass="btn btn-primary"
															value="%{getText('user.search.button')}" /></td>
												</tr>
											</table>
										</s:form></td>
									<td style="width: 100px"></td>
									<td><s:url action="add" namespace="/irisUser"
											var="irisUserAddUrl" /> <s:a href="%{#irisUserAddUrl}"
											cssClass="btn btn-mini btn-primary" targets="targetDiv">
											<s:text name="global.add" />
										</s:a></td>
								</tr>
							</table>

						</div>
						<s:actionerror />

						<s:url var="userNameSortUrl" action="sort" namespace="/irisUser"
							includeParams="none">
							<s:param name="sortBy">NAME</s:param>
						</s:url>
						<s:url var="employeeIdSortUrl" action="sort" namespace="/irisUser"
							includeParams="none">
							<s:param name="sortBy">EMPLOYEE_ID</s:param>
						</s:url>
						<table class="table table-striped">
							<thead>
								<tr>
									<th rowspan="2" class="rowspan"></th>
									<th style="vertical-align: middle;" class="nowrap" rowspan="2">
										<s:a href="%{#userNameSortUrl}">
											<s:text name="user.name" />
										</s:a>
									</th>
									<th style="vertical-align: middle;" class="nowrap" rowspan="2">
										<s:a href="%{#employeeIdSortUrl}">
											<s:text name="user.employee.id" />
										</s:a>
									</th>
									<th style="vertical-align: middle;" class="nowrap center"
										colspan="4"><s:text name="user.registration.flag" /></th>
									<th style="vertical-align: middle;" class="nowrap" rowspan="2"><s:text
											name="user.group" /></th>
									<th style="vertical-align: middle;" class="nowrap" rowspan="2"><s:text
											name="global.last.update" /></th>
									<th rowspan="2"></th>
								</tr>
								<tr>
									<td class="nowrap"><s:text name="user.data.left.eye" /></td>
									<td class="nowrap"><s:text name="user.data.right.eye" /></td>
									<td class="nowrap"><s:text name="user.data.card" /></td>
									<td class="nowrap"><s:text name="user.data.pin" /></td>
									<!-- <th class="nowrap">L</th>
									<th class="nowrap">R</th>
									<th class="nowrap">C</th>
									<th class="nowrap">P</th> -->
								</tr>
							</thead>
							<tbody>
								<s:iterator value="pager.list" status="rowIndexLevel1">
									<s:url var="viewUserUrl" action="view" namespace="/irisUser"
										includeParams="none">
										<s:param name="id" value="%{irisUser.id}" />
									</s:url>
									<s:url var="editUserUrl" action="edit" namespace="/irisUser"
										includeParams="none" escapeAmp="false">
										<s:param name="id" value="%{irisUser.id}" />
									</s:url>
									<tr>
										<td><s:property
												value="%{pager.start + #rowIndexLevel1.index + 1}" /></td>
										<td class="nowrap"><s:a href="%{#viewUserUrl}"
												title="%{irisUser.name}">
												<s:if
													test="%{irisUser.getName().length()>numberOfCharactersInName}">
													<s:property
														value="%{irisUser.getName().substring(0,numberOfCharactersInName)}" />...
												</s:if>
												<s:else>
													<s:property value="irisUser.name" />
												</s:else>
											</s:a></td>
										<td class="nowrap"><s:property
												value="irisUser.employeeId" /></td>
										<td class="nowrap center"><s:if
												test="%{irisData.leftEye.equals('true')}">
												o
											</s:if> <s:else>
												x
											</s:else></td>
										<td class="nowrap center"><s:if
												test="%{irisData.rightEye.equals('true')}">
												o
											</s:if> <s:else>
												x
											</s:else></td>
										<td class="nowrap center"><s:if
												test="%{irisData.card.equals('true')}">
												o
											</s:if> <s:else>
												x
											</s:else></td>
										<td class="nowrap center"><s:if
												test="%{irisData.pin.equals('true')}">
												o
											</s:if> <s:else>
												x
											</s:else></td>
										<td><s:iterator value="groups" status="rowIndexLevel2">
												<s:if test="#rowIndexLevel2.index < numberOfSubItemsInList">
													<span class="nowrap"><s:property value="groupName" /></span>
													<s:if
														test="!#rowIndexLevel2.isLast() && !(#rowIndexLevel2.index == (numberOfSubItemsInList - 1))">
														,&nbsp;&nbsp;
													</s:if>
												</s:if>
												<s:elseif
													test="#rowIndexLevel2.index == numberOfSubItemsInList">
														...
												</s:elseif>
											</s:iterator></td>
										<td class="nowrap"><s:date name="irisUser.updateDatetime"
												format="yyyy/MM/dd" /></td>
										<td class="nowrap"><s:a href="%{#editUserUrl}"
												cssClass="btn btn-mini btn-primary">
												<s:property value="%{getText('global.edit')}" />
											</s:a></td>
									</tr>
								</s:iterator>
							</tbody>
						</table>
					</div>

					<s:include value="/WEB-INF/content/common/pager.jsp"></s:include>
				</div>
			</div>
		</div>
		<s:include value="/WEB-INF/content/common/footer.jsp"></s:include>
	</div>
</body>
</html>